# -*- coding:utf-8 -*-
# @Author: Hanko
from sanic import Sanic, request, response

app = Sanic("sanic_service")


@app.get("/index")
async def index(request: request.Request):
    lst = []
    lst.append(f"请求的url: {request.url}")
    lst.append(f"请求的path: {request.path}")
    lst.append(f"请求的方法: {request.method}")
    lst.append(f"请求的查询参数: {request.query_args}")
    lst.append(f"请求的查询参数: {request.args}")
    lst.append(
        f"a: {request.args.get('a')}, "
        f"b: {request.args.get('b')}, "
        f"a_lst: {request.args.getlist('a')}, "
        f"c: {request.args.get('c')}, "
        f"c: {request.args.get('c', 'xxx')}"
    )
    return response.text("\n".join(lst))


if __name__ == "__main__":
    app.run(host="127.0.0.1", port=8888)
